<template>
  <div class="cluster recovery">
    <a-card style="width: 100%">
      <p slot="title" class="cardTitles">
        <span>超时提醒</span>
      </p>
      <div style="margin-top: 20px" class="table-content">
        <a-table
          bordered
          :columns="columns"
          :data-source="list"
          rowKey="examID"
          :pagination="pagination"
          @change="TableChangePage"
        >
          <template slot-scope="text, record" slot="action">
            <a class="tools" @click="detail(record)">详情</a>
          </template>
        </a-table>
      </div>
    </a-card>
  </div>
</template>

<script>
import question from "@/assets/json/questionList.js";
import { paging } from "assets/js/mixin";
import { getOverdueList } from "@/api/log";
export default {
  mixins: [paging],
  data() {
    return {
      columns: [
        {
          title: "考试ID",
          dataIndex: "examID",
        },
        {
          title: "考试名称",
          dataIndex: "examName",
        },
        {
          title: "结束时间",
          dataIndex: "endTime",
        },
        {
          title: "未完成人数",
          dataIndex: "unCompleteCount",
        },
        {
          title: "操作",
          dataIndex: "action",
          scopedSlots: { customRender: "action" },
        },
      ],
      list: [],
      formLayout: {
        spanCol: { span: 6 },
        wrapperCol: { span: 18 },
      },
    };
  },
  mounted() {
      this.getOverdueListData()
  },
  methods: {
    getOverdueListData() {
      getOverdueList()
        .then((res) => {
            console.log(res)
          if (res.code === 0) {
            this.list = res.data.OverDueInfos
          } else {
            this.$message.destroy();
            this.$message.error(res.msg);
          }
        })
        .catch((err) => {
          this.$message.destroy();
          this.$message.error(err);
        })
        .finally(() => {});
    },
    detail(recode){
        this.$router.push({ name: "examinationDetail", query: { id: recode.examID} });
    },
    TableChangePage(pagination) {
      this.pageNum = pagination.current;
      this.pagination.current = pagination.current;
      this.pagination.pageSize = pagination.pageSize;
      this.getOverdueListData();
    },
  },
};
</script>

<style lang="stylus" scoped>
.formDiv {
  .lable {
    margin-right: 10px;
  }
}

.upload {
  float: right;
}

.recovery {
  height: 100%;
}

.table-content {
  height: calc(100% - 138px);
  overflow: auto;
}

.ant-card-body {
  height: 100%;
}
</style>